var Lex=function(str){
	str=""+str;
	var dict=[];
	this.DQSTRING=/(?!\\)"(\\"|\\.|[^"])*"/g;
	this.QSTRING=/(?!\\)'(\\'|\\.|[^'])*'/g;
	this.toString=function(){return str};
	this.replace=function(re, x){str=str.replace(re, x); return this};
	this.del=function(re){str=str.replace(re,''); return this};
	this.conv=function(re){	str=str.replace(re,function(x){var id=dict.length;dict[id]=x;return "@\["+id+"\]@"}); return this};
	this.uconv=function(){ str=str.replace(/@\[(\d+)\]@/g,function(_,x){return dict[x]}); dict=[]; return this};
	this.decorate=function(pat){str=pat.replace(/\*/,function(){return str}); return this};
	this.decorate_quoted=function(pat){
		this.replace(/['"\\]/g, '\\$&');
		this.decorate("'*'");
		return this.decorate(pat);
	};
};
